]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
autorunManager: Don't try to scan remote filesystems
authorJasper St. Pierre <jstpierre@mecheye.net>
Sun, 16 Sep 2012 17:54:25 +0000 (14:54 -0300)
committerJasper St. Pierre <jstpierre@mecheye.net>
Wed, 3 Oct 2012 17:36:37 +0000 (14:36 -0300)
Content-Type scanning can be super expensive. The autorun manager is meant
for local filesystems that are plugged into a USB port or similar, not
remote NFS or sshfs mounts.

https://bugzilla.gnome.org/show_bug.cgi?id=684093

js/ui/components/autorunManager.js

index 495063e38649e9e69473e90ea3911b847274da16..5490df5b395ae622d2eebf5a9209bef3915631d5 100644 (file)
@@ -44,6 +44,19 @@ function isMountRootHidden(root) {
     return (path.indexOf('/.') != -1);
 }
 
+function isMountNonLocal(mount) {
+    // If the mount doesn't have an associated volume, that means it could
+    // be a remote filesystem. For certain kinds of local filesystems,
+    // like digital cameras and music players, there's no associated
+    // gvfs volume, so err on the side of caution and assume it's a local
+    // filesystem to allow the prompt.
+    let volume = mount.get_volume();
+    if (volume == null)
+        return false;
+
+    return (volume.get_identifier("class") == "network");
+}
+
 function startAppForMount(app, mount) {
     let files = [];
     let root = mount.get_root();
@@ -88,8 +101,9 @@ const ContentTypeDiscoverer = new Lang.Class({
 
     guessContentTypes: function(mount) {
         let autorunEnabled = !this._settings.get_boolean(SETTING_DISABLE_AUTORUN);
+        let shouldScan = autorunEnabled && !isMountNonLocal(mount);
 
-        if (autorunEnabled) {
+        if (shouldScan) {
             // guess mount's content types using GIO
             mount.guess_content_type(false, null,
                                      Lang.bind(this,